unit drv_unit;
 interface
var
   icdev:integer;//COM1,COM2,ParallelPort 公用设备句柄
   st:smallint;
  procedure quit;
 //comm function
 Function fw_init(prot:integer;baud:longint):integer; stdcall;
  far;external 'umf.dll' name 'fw_init';

 Function fw_exit(icdev:integer):smallint; stdcall;
  far;external 'umf.dll' name 'fw_exit' ;

 Function fw_card(icdev:integer;mode:smallint;var snr:longword):smallint; stdcall;
  far;external 'umf.dll' name 'fw_card';

 Function fw_card_hex(icdev:integer;mode:smallint;snrbuf:PAnsichar):smallint; stdcall;
  far;external 'umf.dll' name 'fw_card_hex';//fw_card对应的16进制函数，推荐使用此函数

 Function fw_load_key(icdev:integer;mode,secor:smallint;skey:pchar):smallint; stdcall;
  far;external 'umf.dll' name 'fw_load_key';

 Function fw_authentication(icdev:integer;mode,secor:smallint):smallint; stdcall;
  far;external 'umf.dll' name 'fw_authentication';

 Function fw_read(icdev:integer;adr:smallint;sdata :pchar):smallint; stdcall;
  far;external 'umf.dll' name 'fw_read';

 Function fw_write(icdev:integer;adr:smallint;sdata :pchar):smallint; stdcall;
  far;external 'umf.dll' name 'fw_write';

 Function fw_halt(icdev:integer):smallint; stdcall;
  far;external 'umf.dll' name 'fw_halt';

 Function fw_reset(icdev:integer;msc:smallint):smallint; stdcall;
  far;external 'umf.dll' name 'fw_reset';

 Function fw_beep(icdev:integer;stime:smallint):smallint; stdcall;
  far;external 'umf.dll' name 'fw_beep';

 Function fw_initval(icdev:integer;adr:smallint;value:LongWord):smallint;stdcall;
 far;external 'umf.dll' name 'fw_initval';

 Function fw_readval(icdev:integer;adr:smallint;value:PLongWord):smallint;stdcall;
 far;external 'umf.dll' name 'fw_readval';

 Function fw_decrement(icdev:integer;adr:smallint;value:LongWord):smallint;stdcall;
 far;external 'umf.dll' name 'fw_decrement';

 Function fw_transfer(icdev:integer; adr:smallint):smallint;stdcall;
 far;external 'umf.dll' name 'fw_transfer';

 //Ultralight card funcitons
 Function fw_request_ultralt(icdev:integer;findcardmode:smallint):smallint;stdcall;
 far;external 'umf.dll' name 'fw_request_ultralt';

 Function fw_anticall_ultralt(icdev:integer;var snr:longword):smallint;stdcall;
 far;external 'umf.dll' name 'fw_anticall_ultralt';

 Function fw_select_ultralt(icdev:integer;snr:longword):smallint;stdcall;
 far;external 'umf.dll' name 'fw_select_ultralt';

 Function fw_write_ultralt(icdev:integer;ipage:smallint;wdata:pchar):smallint;stdcall;
 far;external 'umf.dll' name 'fw_write_ultralt';

 function fw_read_ultralt(icdev:integer;ipage:smallint;rdata:pchar):smallint;stdcall;
 far;external 'umf.dll' name 'fw_read_ultralt';


implementation

procedure quit;
  begin
    If icdev > 0 Then begin
       st := fw_reset(icdev, 10);
       st := fw_exit(icdev);
       icdev := -1;
    end;
end;
{
initialization
begin

end;

finalization
begin
end;
 }
end.